From e63796ded511fed3e9e4c1aa16d2868cb05e80d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 15 Apr 2026 23:09:00 +0200 Subject: [PATCH] appFavorites: Move installed-changed where it belongs In the dash we are monitoring the installed applications and reload the favorites, while this is not something that is related to the dash per se, and if the AppFavorites is used to track the favorites elsewhere it would not be updated when new favorite apps are installed. So move the logic to AppFavorites, that will now emit a changed event whenever any favorite changed. Part-of: --- js/ui/appFavorites.js | 7 +++++-- js/ui/dash.js | 5 +---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js index a4ec6cb30..d13a49066 100644 --- a/js/ui/appFavorites.js +++ b/js/ui/appFavorites.js @@ -12,6 +12,10 @@ class AppFavorites extends Signals.EventEmitter { this._parentalControlsManager.connect('app-filter-changed', () => this._updateFavorites()); + this._appSystem = Shell.AppSystem.get_default(); + this._appSystem.connect('installed-changed', + () => this._updateFavorites()); + this.FAVORITE_APPS_KEY = 'favorite-apps'; this._favorites = {}; global.settings.connect(`changed::${this.FAVORITE_APPS_KEY}`, @@ -39,8 +43,7 @@ class AppFavorites extends Signals.EventEmitter { reload() { const ids = global.settings.get_strv(this.FAVORITE_APPS_KEY); - const appSys = Shell.AppSystem.get_default(); - const apps = ids.map(id => appSys.lookup_app(id)) + const apps = ids.map(id => this._appSystem.lookup_app(id)) .filter(app => app !== null && this._parentalControlsManager.shouldShowApp(app.app_info)); this._favorites = {}; for (let i = 0; i < apps.length; i++) { diff --git a/js/ui/dash.js b/js/ui/dash.js index 9ebd348ee..1a0a84142 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -379,10 +379,7 @@ export const Dash = GObject.registerClass({ this._appSystem = Shell.AppSystem.get_default(); - this._appSystem.connect('installed-changed', () => { - AppFavorites.getAppFavorites().reload(); - this._queueRedisplay(); - }); + this._appSystem.connect('installed-changed', () => this._queueRedisplay()); AppFavorites.getAppFavorites().connect('changed', this._queueRedisplay.bind(this)); this._appSystem.connect('app-state-changed', this._queueRedisplay.bind(this)); -- 2.39.5